import axios from 'axios';

/**
 * 查询单个的信息
 */
export function getDictById(id: string) {
  return axios.get(`/upms/dict/${id}`);
}

/**
 *
 * @returns 字典数据分页
 */
export function dictPage(params?: any) {
  return axios.get('/upms/dict/page', { params });
}

/**
 * 添加或修改字典
 */
export function addDict(data: any) {
  return axios.post('/upms/dict', data);
}

/**
 * 修改字典
 */
export function updateDict(data: any) {
  return axios.put('/upms/dict', data);
}

/**
 * 删除字典
 */
export function deleteDict(id: string) {
  return axios.delete(`/upms/dict/${id}`);
}

/**
 *
 * @returns item字典项的分页
 */
export function dictItemPage(params?: {
  dictId?: number;
  current: number;
  size: number;
}) {
  return axios.get('/upms/dict/item/page', { params });
}

/**
 * 单个字典表数据
 */
export function getDictItemById(id: string) {
  return axios.get(`/upms/dict/item/${id}`);
}

/**
 * 添加或修改字典项
 */
export function addDictItem(data: any) {
  return axios.post('/upms/dict/item', data);
}

/**
 * 修改字典项
 */
export function updateDictItem(data: any) {
  return axios.put('/upms/dict/item', data);
}

/**
 * 删除字典项
 */
export function deleteDictItem(id: string) {
  return axios.delete(`/upms/dict/item/${id}`);
}
